package com.example.demo.Controller;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@Slf4j
@RestController
public class SpringLogger {

   // private static Logger logger = LoggerFactory.getLogger(SpringLogger.class);  //通过普通方法来创建对象的就为工厂模式，以前都是通过new创建的对象
    @PostConstruct
    public void print(){
        System.out.println("打印的日志");
        log.info("这是Spring日志框架打印的日志");
    }
}
